package com.cn.aam.checaiduo.ui.product.vadapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.vlayout.LayoutHelper;
import com.alibaba.android.vlayout.layout.StickyLayoutHelper;
import com.cn.aam.checaiduo.R;
import com.cn.aam.checaiduo.base.adapter.BaseVLayoutAdapter;
import com.cn.aam.checaiduo.base.adapter.holder.BaseRecyclerViewHolder;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * @author 艹羊
 * @project Checaiduo_Android
 * @date 2017/6/2 下午3:24
 * @description
 */

public class StickFirstMenuAdapter extends BaseVLayoutAdapter<String> {

    public StickFirstMenuAdapter(Context mContext, String title) {
        super(mContext);
        List<String> list = new ArrayList<>();
        list.add(title);
        setDataToAdapter(list);
    }

    @Override
    protected BaseRecyclerViewHolder getViewHolder(View picNewsView) {
        return new MyViewholder(picNewsView);
    }

    @Override
    protected int getItemLayoutRes() {
        return R.layout.list_vitem_stick;
    }

    @Override
    protected void ItemViewChange(BaseRecyclerViewHolder recyclerholder, int position) {
        ((MyViewholder) recyclerholder).text.setText("" + getItem(position));
    }

    @Override
    public LayoutHelper onCreateLayoutHelper() {
        StickyLayoutHelper StickyLayoutHelper = new StickyLayoutHelper();
        return StickyLayoutHelper;
    }

    public class MyViewholder extends BaseRecyclerViewHolder {
        @BindView(R.id.tv_title)
        TextView text;

        public MyViewholder(View view) {
            super(view);
        }
    }
}
